<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>修改个人资料</title>
    <link rel="stylesheet" href="/stylesheets/personnal.css">
</head>
<body>
<!--导航-->
<%include nav.html%>
<div class="personnal_container">
    <div class="person_left">
    <%include personnal-left.html%>
    </div>
    <div class="person_right">
        <div class="editor_container">
            <div class="editor_header">
                <h3>个人资料</h3>
            </div>
            <div class="editor_nav">
                <a href="/users/editor-basic" class="ui-tab-btn ui-tab-cur">基本资料</a>
                <a href="/users/editor-icon" class="ui-tab-btn">修改头像</a>
            </div>
            <div class="editor_content">
                <div class="editor_section" id="editor_section1">
                    <form id="update_message">
                        <div class="basicinfo-row clearfix">
                            <div class="basicInfo-type f1">
                                <em class="color-orange">*</em>
                                昵称：
                            </div>
                            <div class="basicInfo-cell f1">
                                <input type="text" value="<%=username%>" name="username" class="input">
                                <p class="form_error f1"></p>
                            </div>
                        </div>
                        <div class="basicinfo-row clearfix">
                            <div class="basicInfo-type f1">
                                <em class="color-orange">*</em>
                                性别：
                            </div>
                            <div class="basicInfo-cell f1">
                                <%if(res.length==0){%>


                                <input type="radio" value="1" name="usersex" >男
                                <input type="radio" value="2" name="usersex" >女



                                <%}else if(res[0].usersex==1){%>

                                <input type="radio" value="1" name="usersex" checked>男
                                <input type="radio" value="2" name="usersex" >女

                                <%}else if(res[0].usersex==2){%>

                                <input type="radio" value="1" name="usersex" >男
                                <input type="radio" value="2" name="usersex" checked>女

                                <%}%>

                            </div>
                        </div>
                        <div class="basicinfo-row clearfix">
                            <div class="basicInfo-type f1">
                                出生日期：
                            </div>
                            <div class="basicInfo-cell f1">
                                <%if(res.length==0){%>


                                <input type="date" value="" name="baday" class="input" id="date" required>


                                <%}else{%>

                                <input type="date" value="<%=date%>" name="baday" class="input" id="date" required>


                                <%}%>

                            </div>
                        </div>
                        <div class="basicinfo-row clearfix">
                            <div class="basicInfo-type f1">
                                email：
                            </div>
                            <div class="basicInfo-cell f1">

                                <%if(res.length==0){%>

                                <input type="text" value="" name="mail" class="input" required>

                                <%}else{%>

                                <input type="text" value="<%=res[0].useremail%>" name="mail" class="input" required>

                                <%}%>

                            </div>
                        </div>
                        <div class="basicinfo-row clearfix">
                            <div class="basicInfo-type f1">
                                QQ：
                            </div>
                            <div class="basicInfo-cell f1">
                                <%if(res.length==0){%>

                                <input type="text" value="" name="qq" class="input" required>

                                <%}else{%>

                                <input type="text" value="<%=res[0].qq%>" name="qq" class="input" required>

                                <%}%>

                            </div>
                        </div>
                        <div class="basicinfo-row clearfix">
                            <div class="basicInfo-type f1">
                                城市：
                            </div>
                            <div class="basicInfo-cell f1" id="province">
                                <select class="sel_pro"></select>
                                <select class="sel_city"></select>
                                <select class="sel_street"></select>
                                <input type="text" hidden id="address"  name="city">
                                <!--<select name="city" id="sel_pro" class="select_bk">-->
                                    <!--<option value="0">请选择省份</option>-->
                                <!--</select>-->
                                <!--<select name="city" id="sel_cities" class="city">-->
                                    <!--<option value=""></option>-->
                                <!--</select>-->
                            </div>
                        </div>

                        <div class="basicinfo-row clearfix">
                            <div class="basicInfo-type f1">
                                &nbsp;
                            </div>
                            <div class="basicInfo-cell f1">
                                <input type="submit" id="btn_submit" class="btn_style" value="提交">
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<%include footer.html%>
<!--<script src="//cdn.bootcss.com/jquery/1.11.3/jquery.min.js"></script>-->
<script src="/js/jquery-1.8.3.js"></script>
<script src="/javascripts/three-sports.js"></script>
<!--<script src="/javascripts/personnal.js"></script>-->

<script>
    $(function () {
        $(".editor_nav a").click(function () {
            $(this).addClass('ui-tab-cur').siblings().removeClass('ui-tab-cur');
        })
    });
</script>
<script>
    $(function () {
        $('#update_message').submit(function () {
            if($('.sel_city:visible').val()==undefined){
                $('#address').val(
                        $('.sel_pro:visible').val()+$('.sel_street:visible').val()
                );
            }else{
                $('#address').val(
                        $('.sel_pro:visible').val()+$('.sel_city:visible').val()+$('.sel_street:visible').val()
                );
            }
            $.ajax({
                type:'post',
                url:'/users/editor-basic',
                data:$('#update_message').serialize(),
                timeout:3000,
                dataType:'json',
                success:function (data) {
                    if(data.res==1){
                        alert('修改成功,请重新登录！');
                        location.href="/login";
                    }else{
                        alert('fail')
                    }
                },
                error:function (error) {
                    alert(error.message)
                }

            });
            return false;
        });

    });
</script>
<!--<script>
    $(function(){
        function FormatDate (strTime) {
            var date = new Date(strTime);
            return date.getFullYear()+"-"+(date.getMonth()+1)+"-"+date.getDate();
        }

        $('#hidden').val((FormatDate($('#hidden').val())));
$('#date').val($('#hidden').val())
    })
</script>-->


</body>
</html>